package edu.tyut.game.ui.user.login

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.map
import androidx.lifecycle.switchMap
import cn.hutool.crypto.digest.DigestUtil
import edu.tyut.game.logic.UserRepository
import edu.tyut.game.logic.model.User
import edu.tyut.game.utils.LogUtils

class LoginViewModel : ViewModel(){
    private val tag = "LoginViewModel"
    private val userLiveData = MutableLiveData<User>()
    val user = userLiveData.switchMap {
        UserRepository.login(it)
    }
    fun login(user: User){
        userLiveData.value = user
    }
}// 张书豪